<?php
/* @var $this yii\web\View */
?>
<h1>jquery/index</h1>

<p>
    You may change the content of this page by modifying
    the file <code><?= __FILE__; ?></code>.
</p>

<p>This is a paragraph.</p>
<p>This is a another paragraph.</p>
<ol>
    <li>List item 1</li>
    <li>List item 2</li>
    <li>List item 3</li>
</ol>
<button id="btn1">追加文本</button>
<button id="btn2">追加列表项</button>

<?php
$js = <<<JS
$(document).ready(function() {
  $("#btn1").click(function() {
    $("p").append("<b>Appended text</b>")
  });
  $("#btn2").click(function() {
    $("ol").append("<li>Appended item</li>")
  });
})
JS;
$this->registerJs($js)
?>